home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 13984 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: keats.ugrad.cs.ubc.ca!not-for-mail
  2. From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Largest effective integer.
  5. Date: 10 Apr 1996 12:45:19 -0700
  6. Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
  7. Message-ID: <4kh34fINNlhi@keats.ugrad.cs.ubc.ca>
  8. References: <4ke5gu$o7u@airdmhor.gen.nz> <4kgnm7$hma@crl.crl.com>
  9. NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
  10.  
  11. In article <4kgnm7$hma@crl.crl.com>, Robert Fry <bobfry@crl.com> wrote:
  12.  >gumboot@airdmhor.gen.nz (Simon Hosie) writes:
  13.  >
  14.  >>  What's the highest unsigned value you can safely represent without losing
  15.  >>integer accuracy using an ANSI defined type?  For example you can get as
  16.  >>high as 4294967295 (32 bits) using an unsigned long, or 2251800000000000ish
  17.  >>(51 bits) using an IEEE 8 byte real, but I don't know what the minimum
  18.  >>limits are for reals.
  19.  >
  20.  >The problem is, you don't know for sure that an unsigned long is 32 bits 
  21.  >or that your compiler is using an IEEE 8 byte real.
  22.  >
  23.  >>  Basically I want a really big unsigned int and I don't care what format
  24.  >>it's in or how slow it is.
  25.  >
  26.  >Check out the documentation for <limits.h>
  27.  >
  28.  >More important, look for MAXINT.
  29.  
  30. Wrongo, It's INT_MAX. Too much Pascal coding has rotted your brain. :)
  31.  
  32. And  that's the largest _signed int_ value. He wants the largest possible
  33. unsigned value, which is ULONG_MAX, the size of the local unsigned long, which
  34. is guaranteed by ANSI/ISO to be at least 2^32 - 1.
  35.  
  36. Incorrect answers don't do _anyone_ _any_ good, except the one who is corrected
  37. (and who should have read the FAQ in the first place).
  38. -- 
  39.  
  40.